package com.ivo.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ivo.model.Model;

@Entity
@Table(name = "PDM_O_DATA_TYPE")
public class DataType extends Model
{
	private static final long serialVersionUID = -3850475299713740646L;
	private String typeId;
	private String typeName;
	private String typeName_En;
	private int length;

	private DataType parent;

	@Id
	@Column(name = "DATA_TYPE_ID", length = 5)
	public String getTypeId()
	{
		return typeId;
	}

	public void setTypeId(String typeId)
	{
		this.typeId = typeId;
	}

	@Column(name = "DATA_TYPE_NAME", length = 100)
	public String getTypeName()
	{
		return typeName;
	}

	public void setTypeName_En(String typeName_En)
	{
		this.typeName_En = typeName_En;
	}

	@Column(name = "DATA_TYPE_NAME_EN", length = 100)
	public String getTypeName_En()
	{
		return typeName_En;
	}

	public void setTypeName(String typeName)
	{
		this.typeName = typeName;
	}

	@Column(name = "LENGTH")
	public int getLength()
	{
		return length;
	}

	public void setLength(int length)
	{
		this.length = length;
	}

	@ManyToOne(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY)
	@JoinColumn(name = "PARENT_TYPE_FK", nullable = true)
	public DataType getParent()
	{
		return parent;
	}

	public void setParent(DataType parent)
	{
		this.parent = parent;
	}

}
